package com.ybxx.base.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.ybxx.core.model.BaseModel;

@Entity
@Table(name="tbl_base_ban")
public class Ban extends BaseModel {
	@Id
	private String bid;
	@ManyToOne(targetEntity=Community.class,fetch=FetchType.LAZY)
	@JoinColumn(name="cid",referencedColumnName="cid") 
	private Community community;
	private String bname;
	private String state;
	@OneToMany(targetEntity=Unit.class,cascade={CascadeType.ALL},mappedBy="ban",fetch = FetchType.LAZY)
	private Set<Unit> units=new HashSet<Unit>();
	public String getBid() {
		return bid;
	}
	public void setBid(String bid) {
		this.bid = bid;
	}
	public Community getCommunity() {
		return community;
	}
	public void setCommunity(Community community) {
		this.community = community;
	}
	public String getBname() {
		return bname;
	}
	public void setBname(String bname) {
		this.bname = bname;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public Set<Unit> getUnits() {
		return units;
	}
	public void setUnits(Set<Unit> units) {
		this.units = units;
	}
	
	
}
